package com.linsen.erp.admin.provider.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

//菜单类型
@Getter
@AllArgsConstructor
public enum MenuTypeEnum {
    MODULE(0,"模块"),
    CATALOGUE(1,"目录"),
    MENU(2,"菜单"),
    BUTTON(3,"按钮"),
    ;

    @JsonValue
    private final Integer value;
    private final String desc;

    private static final Map<Integer, MenuTypeEnum> VALUES = new HashMap<>();

    static {
        for (final MenuTypeEnum menuTypeEnum : MenuTypeEnum.values()) {
            MenuTypeEnum.VALUES.put(menuTypeEnum.getValue(), menuTypeEnum);
        }
    }

    @JsonCreator
    public static MenuTypeEnum getByValue(Integer value) {
        return MenuTypeEnum.VALUES.get(value);
    }
}
